import Vue from "vue";
import Router from "vue-router";
import Layout from "@/views/Layout";
import Login from "@/views/Login";

Vue.use(Router);

const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch((err) => err);
};
export default new Router({
  routes: [
    {
      path: "/login",
      name: "Login",
      component: Login,
    },
    {
      path: "/",
      component: Layout,
      children: [
        //首页
        {
          path: "/home",
          name: "Home",
          component: () => import("@/views/Home"),
          meta: {
            title: "统计面板",
          },
          alias: "/",
        },
        {
          path: "Region",
          name: "Region",
          component: () => import("@/views/Region"),
          meta: {
            title: "地区管理",
          },
        },
        {
          path: "Member",
          name: "Member",
          component: () => import("@/views/Member"),
          meta: {
            title: "用户管理",
          },
        },
        {
          path: "ProviderCategory",
          name: "ProviderCategory",
          component: () => import("@/views/Provider/ProviderCategory"),
          meta: {
            title: "商家类目",
          },
        },
        {
          path: "ProviderInfo",
          name: "ProviderInfo",
          component: () => import("@/views/Provider/ProviderInfo"),
          meta: {
            title: "商家管理",
          },
        },
        {
          path: "ProviderGroup",
          name: "ProviderGroup",
          component: () => import("@/views/Provider/ProviderGroup"),
          meta: {
            title: "商家类目",
          },
        },
        {
          path: "ProviderOrder",
          name: "ProviderOrder",
          component: () => import("@/views/Provider/ProviderOrder"),
          meta: {
            title: "商家订单",
          },
        },
        {
          path: "MallCategory",
          name: "MallCategory",
          component: () => import("@/views/Mall/MallCategory"),
          meta: {
            title: "分类管理",
          },
        },
        {
          path: "MallGoods",
          name: "MallGoods",
          component: () => import("@/views/Mall/MallGoods"),
          meta: {
            title: "商品管理",
          },
        },
        {
          path: "MallOrder",
          name: "MallOrder",
          component: () => import("@/views/Mall/MallOrder"),
          meta: {
            title: "订单管理",
          },
        },
        {
          path: "ExpressCompany",
          name: "ExpressCompany",
          component: () => import("@/views/System/ExpressCompany"),
          meta: {
            title: "配送公司",
          },
        },
        {
          path: "OrderRefund",
          name: "OrderRefund",
          component: () => import("@/views/OrderRefund"),
          meta: {
            title: "退款订单",
          },
        },
        {
          path: "Reconciliation",
          name: "Reconciliation",
          component: () => import("@/views/Reconciliation"),
          meta: {
            title: "对账管理",
          },
        },
        {
          path: "Beehive",
          name: "Beehive",
          component: () => import("@/views/Beehive"),
          meta: {
            title: "蜂场管理 ",
          },
        },
        {
          path: "Platform",
          name: "Platform",
          component: () => import("@/views/Article/Platform"),
          meta: {
            title: "平台公告",
          },
        },
        {
          path: "System",
          name: "System",
          component: () => import("@/views/Article/System"),
          meta: {
            title: "系统文章",
          },
        },
        {
          path: "SystemParam",
          name: "SystemParam",
          component: () => import("@/views/System/SystemParam"),
          meta: {
            title: "系统配置",
          },
        },
      ],
    },
  ],
});
